4.17   Plugin Types

This section describes behavior of the Plugin Type object in MWS. It contains the URLs, request bodies, and responses delivered to and from MWS.

The 8.4.13 Fields: Plugin Types reference section contains the type and description of all fields in the Plugin Type object. It also contains details regarding which fields are valid during PUT and POST actions.

Supported Methods

Resource GET PUT POST DELETE
/rest/plugin-types Get All Plugin Types Creating or Updating Plugin Types -- --
/rest/plugin-types/<id> Get Single Plugin Type -- -- --

In this section:

4.17.1 Getting Plugin Types

The HTTP GET method is used to retrieve Plugin Type information. Queries for all objects and a single object are available.

Quick Reference

GET https://localhost:8080/mws/rest/plugin-types/<id>?api-version=3

4.17.1.A  Get All Plugin Types

URLs and Parameters

GET https://localhost:8080/mws/rest/plugin-types?api-version=3

See 3.3  Global URL Parameters for available URL parameters.

Sample Response

GET https://localhost:8080/mws/rest/plugin-types?api-version=3&fields=id
------------------------------------

{
  "totalCount": 2,
  "resultCount": 2,
  "results":   [
    {"id": "vCenter"},
    {"id": "Native"}
  ]
}

4.17.1.B  Get Single Plugin Type

URLs and Parameters

GET https://localhost:8080/mws/rest/plugin-types/<id>?api-version=3
Parameter Required Type Value Description
id Yes String -- The unique identifier of the object.

See 3.3  Global URL Parameters for available URL parameters.

Sample Response

JSON response
------------------------------------

{
  "author": "Adaptive Computing Enterprises, Inc.",
  "commonsVersion": "0.9.3 > *",
  "description": "Polls a VMware® vCenter™ Server for information on the hypervisors and virtual machines it manages.",
  "documentationLink": "",
  "email": "",
  "eventComponent": 1,
  "realizedEventComponent": 513,
  "id": "VCenter",
  "initialPlugins": { },
  "instances": [
    {"id":"vcenter"}
  ],
  "issueManagementLink": "",
  "license": "APACHE",
  "mwsVersion": "10.1.2 > *",
  "pollMethod": true,
  "scmLink": "",
  "title": "VCenter",
  "version": "1.0",
  "webServices": [ ],
  "website": "https://www.adaptivecomputing.com"
}

4.17.2 Creating or Updating Plugin Types

The HTTP PUT method is used to create or update Plugin Types. The Content-Type HTTP header is used to determine if the request contains a single class file as plaintext or the binary data of a JAR file. Each request is explained in the following sections.

Quick Reference

PUT https://localhost:8080/mws/rest/plugin-types?api-version=3[&reload-plugins=false]

There is a known issue with dynamically updating plugin types with typed field injection. For more information, see 6.4.4 Add or Update Plugin Types.

4.17.2.A  Update Plugin Type (File)

URLs and Parameters

PUT https://localhost:8080/mws/rest/plugin-types?api-version=3[&reload-plugins=false]
Parameter Required Type Value Description
reload-plugins No String

true or false

Reloads all plugins of this type on successful update. Defaults to true.

See 3.3  Global URL Parameters for available URL parameters.

Request Body

This function is idempotent, meaning it will create the Plugin Type if it does not exist or update it if it does. The request body is the actual contents of the class file to upload. This web service is an exception to most as it requires a content type of application/x-groovy or text/plain.

If the application/x-groovy or text/plain content types are not used in the request, it will be interpreted as JSON, resulting in a failure.

Plaintext upload
------------------------------------

package test

import com.adaptc.mws.plugins.*

class UploadPlugin {
	static author = "Adaptive Computing"
	static description = "A sample plugin class"
	String id

	public void configure() throws InvalidPluginConfigurationException {
		def myConfig = config
		def errors = []
		if (!myConfig.arbitraryKey)
			errors << "Missing arbitraryKey!"
		if (errors)
			throw new InvalidPluginConfigurationException(errors)
	}

	public def customService(Map params) {
		return params
	}
}

If using the curl library to perform plugin type uploading, the equivalent of the command-line option --data-binary must be used to send the request body. Otherwise compilation errors may be encountered when uploading the plugin type.

Sample Response

The response of this task is the same as the Get All Plugin Types task. The reason that the return of this task is a list is to accommodate the possibility of uploading multiple plugin types in a single JAR file as explained in the next section.

4.17.2.B  Update Plugin Type (JAR)

URLs and Parameters

PUT https://localhost:8080/mws/rest/plugin-types?api-version=3&jar-filename=<filename.jar>[&reload-plugins=false]
Parameter Required Type Value Description
jar-filename Yes String -- The filename of the JAR file that is being uploaded.
reload-plugins No String

true or false

Reloads all plugins of this type on successful update. Defaults to true.

See 3.3  Global URL Parameters for available URL parameters.

Request Body

This function is idempotent, meaning it will create the Plugin Types if they do not exist or update them if they do. The request body is the binary contents of the JAR file to upload. This web service is an exception to most as it requires a content type of application/x-jar.

If the application/x-jar content type is not used in the request, it will be interpreted as JSON, resulting in a failure.

If using the curl library to perform plugin type uploading, the equivalent of the command-line option --data-binary must be used to send the request body. Otherwise compilation errors may be encountered when uploading the plugin type.

Sample Response

The response of this task is the same as the Get All Plugin Types task. Note that when using a JAR file, multiple plugin types can be uploaded in the same request.

Related Topics